﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Steer
{
	public partial class PursueEvadeTest : UserControl
	{
		public PursueEvadeTest()
		{
			// Required to initialize variables
			InitializeComponent();
            Loaded += new RoutedEventHandler(PursueEvadeTest_Loaded);
		}

        void PursueEvadeTest_Loaded(object sender, RoutedEventArgs e)
        {
            myPursuer.position = new Vector2D(200, 200);
            myPursuer.edgeBehavior = Vehicle.BOUNCE;

            myEvader.position = new Vector2D(400, 300);
            myEvader.edgeBehavior = Vehicle.BOUNCE;

            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }

        void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            myPursuer.pursue(myEvader);
            myEvader.evade(myPursuer);

            myPursuer.update();
            myEvader.update();
        }
	}
}